- show_cancel_button = local_assigns.fetch(:cancel, false)

= gitlab_ui_form_for @application, url: url, html: { role: 'form', class: 'doorkeeper-app-form gl-max-w-80 gl-inline-block' } do |f|
  = form_errors(@application)

  .form-group
    = f.label :name, class: 'label-bold'
    = f.text_field :name, class: 'form-control gl-form-input', required: true

  .form-group
    = f.label :redirect_uri, class: 'label-bold'
    = f.text_area :redirect_uri, class: 'form-control gl-form-input gl-form-textarea', required: true

    %span.form-text.gl-text-subtle
      = _('Use one line per URI')

  .form-group
    = f.gitlab_ui_checkbox_component :confidential, _('Confidential'),
      help_text: _('Enable only for confidential applications exclusively used by a trusted backend server that can securely store the client secret. Do not enable for native-mobile, single-page, or other JavaScript applications because they cannot keep the client secret confidential.')

  .form-group
    = f.label :scopes, class: 'label-bold'
    = render 'shared/tokens/scopes_form', prefix: 'authn_oauth_application', token: @application, scopes: @scopes, f: f

  .gl-mt-3
    = f.submit _('Save application'), pajamas_button: true
    - if show_cancel_button
      = render Pajamas::ButtonComponent.new(button_options: { type: 'reset', class: 'js-webhook-edit-close gl-ml-2 js-toggle-button' }) do
        = _('Cancel')
